<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>响应式轮播图</title>
    <link href="lib/boostrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="lib/html5shiv/html5shiv.min.js"></script>
    <!--引入css 文件-->
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .mb_imageBox{
            display: block;
            width: 100%;
        }
        .mb_imageBox>img{
            display: block;
            width: 100%;
        }
        /*pc 的样式*/
        .pc_image_box{
            width: 100%;
            height: 410px;
            display: block;
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
        }

    </style>
</head>
<body>
<!--轮播图-->
<div class="wjs_banner">
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
        <ol class="carousel-indicators">
            <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            <li data-target="#carousel-example-generic" data-slide-to="3"></li>
        </ol>
        <!--轮播项-->
        <div class="carousel-inner" role="listbox">
            <!--轮播图片动态生成位置-->
        </div>
        <!-- Controls -->
        <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>

</div>
<!--如果是pc 端，就是这部分数据-->
<script type="text/template" id="templateId">
    <%for(var i=0;i<list.length;i++){%>
    <%if(i==0){%>
    <div class="item active">
        <%}else{%>
        <div class="item">
            <%}%>
            <%if(isMobile){%>
            <a href="#" class="mb_imageBox hidden-lg hidden-md hidden-sm">
                <img src="<%=list[i].mb_image%>">
            </a>
            <%}else{%>
            <a href="#" class="pc_image_box hidden-xs" style="background-image: url('<%=list[i].pc_image%>')"></a>
            <%}%>
        </div>
        <%}%>
</script>
<script src="lib/jQuery/jquery.min.js"></script>
<script src="lib/boostrap/js/bootstrap.js"></script>
<script src="js/template-native.js"></script>
<script src="js/index.js"></script>

</body>
</html>